package com.ysz.mapper;

import com.ysz.annotation.Mark;
import com.ysz.pojo.CRUDPojo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @ClassName TestCRUDMapper
 * @Description TODO
 * @Data 17:04
 * @Version 1.0
 * @Author ysz
 */
@Mapper
public interface TestCRUDMapper {
    /**
     * 测试aop数据新增
     *
     * @param crudPojo 数据库字段新增添加人添加时间
     * @return 新增成功返回1  否则返回0
     * @throws
     * @author ysz
     * @date 2021/7/21 17:07
     */
    @Insert("insert into test_crud(create_by, create_time) " +
            "values(#{a.create_by}, #{a.create_time})")
    int insertRecording(String s, @Param("a") CRUDPojo crudPojo);


    /**
     * 测试aop数据修改
     *
     * @param crudPojo 数据库字段新增修改人和修改时间
     * @return 新增成功返回1  否则返回0
     * @throws
     * @author ysz
     * @date 2021/7/21 17:07
     */
    @Update("update test_crud set update_by = #{b.update_by}, " +
            "update_time = #{b.update_time} where id=3")
    @Mark(updateByMapping = "update_by", updateTimeMapping = "update_time", index = 2)
    int updateRecording(String s, int age, @Param("b") CRUDPojo crudPojo);
}
